<?
class managers_admin
{
	var $template="list";
	
	var $user_types = array("manager"=>"Менеджеры","admin"=>"Администраторы");
	//var $user_types = array("admin"=>"Администраторы");
	
	
	function Render()
	{
		$form = new Form();
		$form->table = "manager";
		
		$form->Add(new     Str("title",    "Имя"    ));
		$form->Add(new     Str("login",    "Логин"  ));
		$form->Add(new     Str("password", "Пароль" ));
		$form->Add(new  Select("type", "Группа",  $this->user_types  ));
		$form->Add(new  ValidatorNotEmpty("title","Введите имя" ));
		$form->Add(new  ValidatorNotEmpty("login","Введите логин" ));
		$form->Add(new  ValidatorNotEmpty("password","Введите пароль" ));
		
		$html_form = $form->Render();
		
		$dao = Array();
		
		if($_REQUEST["filter"]=="")		$filter="type='manager'";
		if($_REQUEST["filter"]=="admin")		$filter="type='admin'";
		
		$pagerSelect = new Pager("select * from manager where $filter" );
		$pagerSelect->def_sortby="title";
		$dao["rows"] = $pagerSelect->GetRows();
		$dao["pager"] = $pagerSelect->RenderPager();
		
		$tabs = new Tabs();
		$tabs->Add('','Менеджеры');
		$tabs->Add('admin','Администраторы');
		
		$dao["tabs"] = $tabs->Render();
		
		$html_list = TemplaterParse(GetAdminTemplate($this->template),$dao);
		
		echo RenderAdmin($html_form,$html_list);
	}
}
?>